home *** CD-ROM | disk | FTP | other *** search
Wrap
--PRINT CODE --PROPERTY VARIABLES global gTextToBePresented --PrintContainer contains all the print properties and methods associated with the printing text and image components. --The properties and methods are defined below. global printer property PrintList -- list of items set to print property PrintLayoutList -- property list of items containing item propertie set to print property PrintPageBreak -- boolean set true if text screen contains a page break, false otherwise property PrintCopyRight -- name of copyright field, contain copyright statement property PrintPageNumber -- current print page number property PrintPageNumberBoolean -- True if user has selected to print number in lower rigth side of document property PageCount -- total number of pages to print on new me set PrintList = [] set PrintLayoutList = [] set PrintPageBreak = 36 set PrintPageNumber = 1 set PrintPageNumberBoolean = 1 set PageCount = 0 set PrintCopyRight = "Copyright" return me end --TAKES: PrintContainer object --DOES: creates PrintLayoutList --RETURNS: PrintLayoutList on setPrintLayOut me -- • initalize vars set FieldName = "" set CurrentPage = 1 set FieldName = "" set LineCounter = 0 -- • get QuarkContianer object set QuarkContainer = getAt(the actorlist, 1) -- • get list of field contained within text container set LayOut = the LayOut_list of QuarkContainer set Odd = count(LayOut) mod 6 set Num0fPages = count(LayOut) / 6 -- • check if number of pages is odd and not less the two print documents -- • single and multiple print documtents are treated differently ,ie. mulitple print pages requires two block checking -- • check for odd number of pages if Odd = 3 and Num0fPages <> 0 then set Num0fPages = Num0fPages + 1 end if -- • do if more than two pages if Num0fPages <> 0 then -- • repeat to number of print pages repeat With outercounter = 1 to Num0fPages -- • reminder: Layout information is partition in three pieces: offset information, start field and end field -- • get start field of screen page set Start = getAt(LayOut,((CurrentPage* 6)-6) + 2) -- • if odd number of pages and current ly setting the last screen page then excute --else excute other statement if Odd =3 and outercounter= Num0fPages then set Finish = getAt(LayOut,((CurrentPage * 6)-6)+3) set Middle = getAt(LayOut,((CurrentPage * 6)-6)+3) else set Finish = getAt(LayOut,((CurrentPage * 6))) set Middle = getAt(LayOut,((CurrentPage * 6)-1)) end if -- • parse through the fields of the screen page outercounter add info to PrintLayoutList repeat with counter = Start to Finish set FieldName = getat(PrintList,counter) set LineCounte = the number of lines in field FieldName set Justification = the alignment of member FieldName -- • if text block equal the second part ot text bock splt then check if need to recover lost info if counter = Middle then TestToAddSpace me,FieldName,CurrentPage,counter add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] else set Content = the text of field FieldName set LineOne = line 1 of Content set LastLine = line LineCounte of Content -- • Check for carriage return at beginng of text field and add correct response to PriontLayoutList if (LineOne = "" and LastLine = "") or (LineOne = " " and LastLine = "") or (LineOne = "" and LastLine = " ") or (LineOne = " " and LastLine = " ") then set CurrentNum = count (PrintLayoutList) set PrevRec = getAt(PrintLayoutList , CurrentNum) set PrevRecName = getProp(PrevRec , #FieldName) if PrevRecName <> "Level0" then add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:CurrentPage ] end if add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] if counter <> Finish then add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:CurrentPage ] end if else if LineOne = "" or LineOne = " " then set CurrentNum = count (PrintLayoutList) set PrevRec = getAt(PrintLayoutList , CurrentNum) set PrevRecName = getProp(PrevRec , #FieldName) if PrevRecName <> "Level0" then add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:CurrentPage ] end if add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] -- else if LastLine = "" or LastLine = " " then -- add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] -- -- if counter <> Finish then -- add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:CurrentPage ] -- end if -- else add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] end if end if end repeat -- • Increment Current page set CurrentPage =CurrentPage + 1 end repeat else -- • do if more than one page -- • get start and finish field of screen page set Start = getAt(LayOut,2) set Finish = getAt(LayOut,3) repeat with counter = Start to Finish -- • get properies of field set FieldName = getat(PrintList,counter) set LineCounte = the number of lines in field FieldName set Justification = the alignment of member FieldName -- • if text block equal the second part of text bock splt then check if need to recover lost info if counter = Middle then TestToAddSpace me,FieldName,CurrentPage,counter add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] else set Content = the text of field FieldName set LineOne = line 1 of Content set LastLine = line LineCounte of Content -- • Check for carriage return at beginng of text field and add correct response to PriontLayoutList if (LineOne = "" and LastLine = "") or (LineOne = " " and LastLine = "") or (LineOne = "" and LastLine = " ") or (LineOne = " " and LastLine = " ") then set CurrentNum = count (PrintLayoutList) set PrevRec = getAt(PrintLayoutList , CurrentNum) set PrevRecName = getProp(PrevRec , #FieldName) if PrevRecName <> "Level0" then add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:CurrentPage ] end if add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] if counter <> Finish then add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:CurrentPage ] end if else if LineOne = "" or LineOne = " " then set CurrentNum = count (PrintLayoutList) set PrevRec = getAt(PrintLayoutList , CurrentNum) set PrevRecName = getProp(PrevRec , #FieldName) if PrevRecName <> "Level0" then add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:CurrentPage ] end if add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] -- else if LastLine = "" or LastLine = " " then -- add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] -- -- if counter <> Finish then -- add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:CurrentPage ] -- end if -- else add PrintLayoutList [#FieldName:FieldName ,#Just:Justification, #Start:1,#End: LineCounte,#Page:CurrentPage] end if end if end repeat end if put PrintLayoutList end --TAKES: PrintContainer object --DOES: calls print-o-matic methods to print General and Question Docs --RETURNS: n/a on setPrintDocument me -- • initalize vars set TextContainer = getAt(the actorlist, 2) set QPageCount = getTotalPage (TextContainer) set CurrentPrintPage = 1 set PageHeight =printer (mGetPageHeight) set Count = Count( PrintLayoutList) set LastPrintRec = getAt(PrintLayoutList , Count) set MemberPrintRec = getAt(PrintLayoutList , 1) set MemberName = getProp(MemberPrintRec, #fieldName) set PageCount = getProp(LastPrintRec, #Page) set MemberPrintRec = getAt(PrintLayoutList , 1) -- • set Question Switch set QuestionSwitch = CheckForQuestions (me , gTextToBePresented) if QuestionSwitch = true then set PageCount = QPageCount end if set NumberSwitch = false set EndCounter =count(PrintLayoutList ) -- • repeat to number of total number of items in PrintLayoutList repeat With counter = 1 to EndCounter set MemberPrintRec = getAt(PrintLayoutList , Counter) set MemberName = getProp(MemberPrintRec, #FieldName) set MemberJustification = getProp(MemberPrintRec, #Just) set MemberStartLine = getProp(MemberPrintRec, #Start) set MemberEndLine = getProp(MemberPrintRec, #End) set MemberPage = getProp(MemberPrintRec, #Page) -- • if Question Switch = true then check if the field contain questions if QuestionSwitch = true then Set NumberSwitch = FindNumberInField (me,MemberName ) end if -- • print copyright statement at bottom of print document if CurrentPrintPage <> MemberPage then -- • call Copyright print method and print number at lower right corner PrintCopyright me PrintPageNumber me, CurrentPrintPage set CurrentPrintPage = MemberPage -- • create and add new page to print-o-matic object New_Page_doc me set VertOffset= 0 else if counter =1 then set VertOffset= 0 else -- • print text block are place vertically using print-o-matic's Insertion Point Method set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) end if -- • createnew Print Text block Create_text_block me, 0, VertOffset ,400,PageHeight ,false Set_justification me,MemberJustification set MemberNameAsList = [] do"set MemberNameAsList = [MemberName]" -- • Number switch is true for question docs if NumberSwitch <> true then AppendStyledText (me,printer,MemberName , false) else -- • add correct number of empty spaces after numbered questions if QPageCount = 1 then setPrintQuestionDocument me,MemberName else if counter <> EndCounter then setPrintQuestionDocument me,MemberName else -- • print number at lower right corner PrintPageNumber me, CurrentPrintPage set MemberTag = ["Empt"] set VertOffset= 0 Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" PrintStyledLine me, MemberTag, 1 ,1 New_Page_doc me setPrintQuestionDocument me,MemberName set CurrentPrintPage = 2 set QPageCount = 2 end if end if end if end Repeat PrintPageNumber me, CurrentPrintPage -- • call Copyright print method PrintCopyright me end if end --TAKES: PrintContainer object, FieldName, Current Page --DOES: checks first line state for two blocks scenario --RETURNS: n/a on TestToAddSpace me,pasFieldName,pasCurrentPage,pascounter set firstchar = char 1 of field pasFieldName set firstword = word 1 of field pasFieldName set charvalue = charToNum(firstchar ) set numchar = the number of chars in firstword set wordvalue = 0 set BoldSequence = false set PrevField = getAt(PrintList,pascounter) set NumlinePrev = the number of lines in field PrevField set LastLineCnt = line NumlinePrev of field pasFieldName --NOTES: "a" = ASCII 97 -- "z" = ASCII "122" -- "A" = ASCII "65" -- "Z" = ASCII "90" -- "•" = ASCII "165" -- • calculate the vlaue of th first word, defined as the sum of char ASCII values repeat with counter = 1 to numchar set firstwordchar = char counter of firstword set wordvalue = wordvalue + charToNum(firstwordchar ) end repeat -- • if first char value greater then 97 ("a")and less 122 ("z")then lower case char ,thus two block is a break in a paragraph if charvalue >= 97 and charvalue <= 122 then -- put "Lower case" don't add spaces, it is a paagraph break return else if charvalue >= 65 and charvalue <= 90 then -- put "Lower case" don't add spaces, it is a paagraph break return else if (charvalue >= 48 and charvalue <= 57) or charvalue = 165 then set CurrentNum = count (PrintLayoutList) set PrevRec = getAt(PrintLayoutList , CurrentNum) set PrevRecName = getProp(PrevRec , #FieldName) if PrevRecName <> "Level0" then add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:pasCurrentPage ] end if return set numlines = the number of lines in field pasFieldNAme -- • to be a number or bullet sequence must be greater then 2 lines if numlines > 2 then repeat with counter = 2 to numlines set previous = line counter -1 of field pasFieldNAme set current = line counter of field pasFieldNAme set prevchar = char 1 of line counter -1 of field pasFieldNAme set curchar = char 1 of line counter of field pasFieldNAme set prevalue = charToNum(prevchar) set curvalue = charToNum(curchar ) -- • checking for with or without empty spaces separating text blocks if ( prevalue >= 48 and prevalue <= 57 or prevalue = 165 ) and current = "" and LastLineCnt <> "" then -- put "Level 2: Num or Bull with space" set CurrentNum = count (PrintLayoutList) set PrevRec = getAt(PrintLayoutList , CurrentNum) set PrevRecName = getProp(PrevRec , #FieldName) if PrevRecName <> "Level0" then add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:pasCurrentPage ] end if return else if (prevalue >= 48 and prevalue <= 57 or prevalue= 165 ) and LastLineCnt <> "" and ( curvalue >= 48 and curvalue <= 57 or curvalue = 165 ) then -- put "Level 3: Num or Bull without space" return end if end repeat end if -- -- • if uppercase and bold or bold then add space and not a number or bullet --else if wordvalue < numchar* 97 and not( charvalue >= 48 and charvalue <= 57 or charvalue = 165) and LastLineCnt <> "" then --set CurrentNum = count (PrintLayoutList) --set PrevRec = getAt(PrintLayoutList , CurrentNum) --set PrevRecName = getProp(PrevRec , #FieldName) --if PrevRecName <> "Level0" then --add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:pasCurrentPage ] --end if --return --else if the fontStyle of word 1 of field pasFieldNAme = "bold" and LastLineCnt <> "" then -- put "Level 4: Bold Word " --set CurrentNum = count (PrintLayoutList) --set PrevRec = getAt(PrintLayoutList , CurrentNum) --set PrevRecName = getProp(PrevRec , #FieldName) --if PrevRecName <> "Level0" then --add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:pasCurrentPage ] --end if --return --- • if uppercase --else if charvalue >= 65 and charvalue <= 90 and LastLineCnt <> "" then --set CurrentNum = count (PrintLayoutList) --set PrevRec = getAt(PrintLayoutList , CurrentNum) --set PrevRecName = getProp(PrevRec , #FieldName) --if PrevRecName <> "Level0" then --add PrintLayoutList [#FieldName:"Level0" ,#Just:"left", #Start:1,#End: 1,#Page:pasCurrentPage] --end if --return end if end --TAKES: PrintContainer object, member name --DOES: add correct number of empty lines after numbered questions .ie 3 or 4 lines --RETURNS: n/a on setPrintQuestionDocument me,pasMemberName set PageHeight =printer (mGetPageHeight) set numlines = the number of lines in field pasMemberName repeat with counter = 1 to numlines set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) set curline = line counter of field pasMemberName set nextline = line counter+ 1 of field pasMemberName if curline = "" and nextline = "" then set MemberName ="Level0" set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" AppendStyledText (me,printer,MemberName , false) set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" AppendStyledText (me,printer,MemberName , false) set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" AppendStyledText (me,printer,MemberName , false) set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" PrintStyledLine me,MemberName, 1 ,1 set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" AppendStyledText (me,printer,MemberName , false) set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" set MemberNameAsList = [] do"set MemberNameAsList = [pasMemberName]" AppendStyledText (me,printer,MemberName , false) set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" set MemberNameAsList = [] do"set MemberNameAsList = [pasMemberName]" AppendStyledText (me,printer,MemberName , false) set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" set MemberNameAsList = [] do"set MemberNameAsList = [pasMemberName]" AppendStyledText (me,printer,MemberName , false) else set firstword =word 1 of line counter of field pasMemberName set secondword = word 2 of line counter of field pasMemberName if firstword = "1." or secondword = "1." then set MemberName = "Level0" set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" AppendStyledText (me,printer,MemberName , false) end if set Insrtion_List = "" set Insrtion_List = Printer( mGetInsertionPoint) set the itemDelimiter to "," set VertOffset = value(item 3 of Insrtion_List) Create_text_block me, 0, VertOffset,400,PageHeight ,false Set_justification me,"left" set MemberNameAsList = [] do"set MemberNameAsList = [pasMemberName]" PrintStyledLine me,MemberNameAsList, counter ,counter end if end repeat end --TAKES: PrintContainer object, member name --DOES: finds number in current line of field --RETURNS: true is found number otherwise false on FindNumberInField me, pasFieldNAme set numlines = the number of lines in field pasFieldNAme repeat with counter = 1 to numlines set firstchar = char 1 of line counter of field pasFieldNAme set charvalue = charToNum( firstchar) set NumSwitch = false if charvalue >= 48 and charvalue <= 57 then set NumSwitch = true exit repeat else set NumSwitch = false end if end repeat return NumSwitch end --TAKES: PrintContainer object --DOES: Print-o-matic append style txt method --RETURNS:n/a on AppendStyledText me, obj, theCast, autoAppend set Name = theCast set styleList = BuildStyleList( me,theCast) repeat with cnt = 1 to count (styleList) set styleRun = getAt(styleList,cnt) obj(mSetTextFont,getAProp(styleRun,#font)) obj(mSetTextSize,getAProp(styleRun,#size)) obj(mSetTextStyle,getAProp(styleRun,#style)) set Colors = getAProp(styleRun,#color) if Colors <> 0 then obj(mSetColor, 0, 0, 0) else obj(mSetColor, 255, 255, 255) end if set charsAdded = obj(mAppendText,char getAProp(styleRun,#start) to ¬ getAProp(styleRun,#end) of field theCast, autoAppend) if charsAdded = 0 then exit end repeat end --TAKES: PrintContainer object --DOES: Print-o-matic style txt list method --RETURNS:n/a on BuildStyleList me, theCast set styleList = [] set curFont = "" set curSize = 0 set curStyle = "" set curColor = 0 repeat with cnt = 1 to the number of chars in field theCast if the textFont of char cnt of cast theCast <> curFont ¬ or the textSize of char cnt of cast theCast <> curSize ¬ or the textStyle of char cnt of cast theCast <> curStyle then if count(styleList) then setAProp getAt(styleList,count(styleList)), #end, cnt-1 set curFont = the textFont of char cnt of cast theCast set curSize = the textSize of char cnt of cast theCast set curStyle = the textStyle of char cnt of cast theCast set curColor = the forecolor of char cnt of cast theCast add styleList, [#font:curFont,#size:curSize,#style:curStyle,#start:cnt,#end:cnt,#color:curColor] end if end repeat if count(styleList) then setAProp getAt(styleList,count(styleList)), #end, the number of chars in field theCast end if return styleList end --TAKES: PrintContainer object --DOES: copyright print code --RETURNS:n/a on PrintCopyright me Create_text_block me,0, 650,391,printer(mGetPageHeight),false Set_justification me, "left" AppendStyledText (me,printer,PrintCopyRight, false) end --TAKES: PrintContainer object --DOES: number print code --RETURNS:n/a on PrintPageNumber me,PgNumber Create_text_block me,378, 650 ,430,printer(mGetPageHeight),false Set_justification me, "center" set QuarkContainer = getAt(the actorlist, 1) Set PageNumber = "PageNumber" Set the text of field PageNumber to PgNumber&&"of" &&PageCount AppendStyledText (me,printer,PageNumber, false) end --TAKES: PrintContainer object --DOES: creates new print page --RETURNS:n/a on Create_page me global printer printer (mNewPage) end on initInitializePrintDoc me Initialize_doc me Create_doc me Reset_doc me end on setPrintList me, pasPrintList set PrintList = pasPrintList end on setPrint me,Print_type Print_doc me,Print_type end on getPrintLayOut me return PrintLayOut end on Print_doc me,state global printer --Case for different print state case state of 1: --Print with dialog box if printer (mDoJobSetup) = true then updateStage printer (mPrint) end if --print without a dialog box 2: printer (mPrint) --print preveiw 3: printer (mPrintPreview) end case end on New_Page_doc me printer (mNewPage) end on SetLandscpape me,boolean printer (mSetLandscapeMode, boolean) end --TAKES: PrintContainer object --DOES: Print-o-matic print bitmap method --RETURNS:n/a on SetmPicture me,PIcture,left,top, right, bottom --printer(mPicture,the picture of cast theCast,left,top,left+w,top+h) printer(mPicture,PIcture,left,top, right, bottom) end --TAKES: PrintContainer object --DOES: initialize xcmd or dll --RETURNS:n/a on Initialize_doc me global gXObjFile if the machineType = 256 then put "pmatic.dll" into gXObjFile else put "pmatic.xobj" into gXObjFile end if end --TAKES: PrintContainer object --DOES: create instance of print-o-matic --RETURNS:n/a on Create_doc me global printer, gXObjFile if not objectP(printer) then openxlib gXObjFile set printer = PrintOMatic(mNew) end if if not objectP(printer) then Alert "There is no currently selected printer. Printing features are disabled." else printer(mRegister,"PMAT130-245-01296") end if end --TAKES: PrintContainer object --DOES: Print-o-matic destructor sequence --RETURNS:n/a on DestroyPrint me Dispose_doc me Close_doc me end --TAKES: PrintContainer object --DOES: Print-o-matic dispose method --RETURNS:n/a on Dispose_doc me printer(mDispose) end --TAKES: PrintContainer object --DOES:close Print-o-matic xcmd or dll --RETURNS:n/a on Close_doc me global gXObjFile closeXlib gXObjFile end --TAKES: PrintContainer object --DOES: Print-o-matic reset method --RETURNS:n/a on Reset_doc me printer (mReset) end --TAKES: PrintContainer object --DOES: Print-o-matic set margins method --RETURNS:n/a on Set_margins me,left,top, right,bottom printer (mSetMargins,left,top, right, bottom) set PageWidth = printer (mGetPageWidth) set PageHeight = printer (mGetPageHeight) end --TAKES: PrintContainer object --DOES: Print-o-matic create text block method --RETURNS:n/a on Create_text_block me,t,m,w,h, boolean printer (mTextBox,t,m,w,h,boolean) end --TAKES: PrintContainer object --DOES: Print-o-matic jusification method --RETURNS:n/a on Set_justification me, state printer (mSetTextJust, state) end --TAKES: PrintContainer object, member name --DOES: checks for print documentt type --RETURNS: true isf question doc otherwise false on CheckForQuestions me ,pasMemberName set numchar = the number of chars in pasMemberName repeat with counter = 1 to numchar set curchar = char counter of pasMemberName set Switch = false if curchar = "Q" or curchar = "q" then set Switch = true exit repeat else set Switch = false end if end repeat return Switch end --TAKES: PrintContainer object --DOES: Print-o-matic append printstyle char method --RETURNS:n/a on PrintStyledLine me,castList, Start_Line, End_Line global printer, gXObjFile if not listP(castList) then exit repeat with cnt = 1 to count(castList) repeat with Counter = Start_Line to End_Line AppendStyledLineText (me,printer,getAt(castList,cnt),Counter, true) Append_text RETURN, false end repeat end repeat end if end --TAKES: PrintContainer object --DOES: modified Print-o-matic Append Stlye start and end lines method --RETURNS:n/a on AppendStyledLineText me,obj, theCast, Start_Line,autoAppend if not objectP(obj) then exit if (not integerP(theCast)) and (not stringP(theCast)) then exit if the castType of cast theCast <> #text then exit if not(the number of chars in field theCast) then exit if not integerP(autoAppend) then set autoAppend = FALSE set styleList = BuildStyleLineList(me,theCast, Start_Line) repeat with cnt = 1 to count (styleList) set styleRun = getAt(styleList,cnt) obj(mSetTextFont,getAProp(styleRun,#font)) obj(mSetTextSize,getAProp(styleRun,#size)) obj(mSetTextStyle,getAProp(styleRun,#style)) set Colors = getAProp(styleRun,#color) if Colors <> 0 then obj(mSetColor, 0, 0, 0) else obj(mSetColor, 255, 255, 255) end if set charsAdded = obj(mAppendText,char getAProp(styleRun,#start) to ¬ getAProp(styleRun,#end) of line Start_Line of field theCast, autoAppend) if theCast = "line" then Append_text RETURN, false end if if charsAdded = 0 then exit end if end repeat end --TAKES: PrintContainer object --DOES: Print-o-matic Build style list method --RETURNS:n/a on BuildStyleLineList me,theCast,Line_Count if the castType of cast theCast <> #text then return [] set styleList = [] set curFont = "" set curSize = 0 set curStyle = "" set curColor = 0 set NumOfChars = 0 set NumOfChars = the number of chars in line Line_Count of field theCast if NumOfChars = 0 then Append_text RETURN, false end if repeat with cnt = 1 to NumOfChars if the textFont of char cnt of line Line_Count of field theCast <> curFont ¬ or the textSize of char cnt of line Line_Count of field theCast <> curSize ¬ or the textStyle of char cnt of line Line_Count of field theCast<> curStyle then if count(styleList) then setAProp getAt(styleList,count(styleList)), #end, cnt-1 -- set our variables to the new current style put the textFont of char cnt of line Line_Count of field theCast into curFont put the textSize of char cnt of line Line_Count of field theCast into curSize put the textStyle of char cnt of line Line_Count of field theCast into curStyle set curColor = the forecolor of char cnt of line Line_Count of field theCast add styleList, [#font:curFont,#size:curSize,#style:curStyle,#start:cnt,#end:cnt,#color:curColor] end if end repeat --close out the last style run in the list if count(styleList) then setAProp getAt(styleList,count(styleList)), #end, the number of chars of line Line_Count of field theCast end if return styleList end